import request from '@/utils/request'
import Cookies from 'js-cookie'

export function tripList(query) {
  return request({
    url: '/manage/trip/',
    method: 'get',
    params: query
  })
}

export function tripCreate(data, token) {
  return request({
    url: '/manage/trip/create',
    method: 'post',
    params: { token },
    headers: {
      'X-CSRFToken': Cookies.get('csrftoken')
    },
    data
  })
}

export function tripUpdate(data, token) {
  return request({
    url: '/manage/trip/',
    method: 'put',
    params: { token },
    headers: {
      'X-CSRFToken': Cookies.get('csrftoken')
    },
    data
  })
}
export function tripDelete(data, token) {
  return request({
    url: '/manage/trip/',
    method: 'delete',
    params: { token },
    headers: {
      'X-CSRFToken': Cookies.get('csrftoken')
    },
    data
  })
}

export function stationList(query) {
  return request({
    url: '/manage/station/',
    method: 'get',
    params: query
  })
}

export function stationCreate(data, token) {
  return request({
    url: '/manage/station/',
    method: 'post',
    params: { token },
    headers: {
      'X-CSRFToken': Cookies.get('csrftoken')
    },
    data
  })
}

export function stationUpdate(data, token) {
  return request({
    url: '/manage/station/',
    method: 'put',
    params: { token },
    headers: {
      'X-CSRFToken': Cookies.get('csrftoken')
    },
    data
  })
}
export function stationDelete(data, token) {
  return request({
    url: '/manage/station/',
    method: 'delete',
    params: { token },
    headers: {
      'X-CSRFToken': Cookies.get('csrftoken')
    },
    data
  })
}
export function workdayList(query) {
  return request({
    url: '/manage/workday/',
    method: 'get',
    params: query
  })
}

export function workdayCreate(data, token) {
  return request({
    url: '/manage/workday/',
    method: 'post',
    params: { token },
    headers: {
      'X-CSRFToken': Cookies.get('csrftoken')
    },
    data
  })
}

export function workdayUpdate(data, token, date) {
  return request({
    url: '/manage/workday/',
    method: 'put',
    params: { token, date },
    headers: {
      'X-CSRFToken': Cookies.get('csrftoken')
    },
    data
  })
}
export function workdayDelete(data, token) {
  return request({
    url: '/manage/workday/',
    method: 'delete',
    params: { token },
    headers: {
      'X-CSRFToken': Cookies.get('csrftoken')
    },
    data
  })
}
export function passengerList(query) {
  return request({
    url: '/manage/passenger/',
    method: 'get',
    params: query
  })
}

export function passengerCreate(data, token) {
  return request({
    url: '/manage/passenger/',
    method: 'post',
    params: { token },
    headers: {
      'X-CSRFToken': Cookies.get('csrftoken')
    },
    data
  })
}

export function passengerUpdate(data, token) {
  return request({
    url: '/manage/passenger/',
    method: 'put',
    params: { token },
    headers: {
      'X-CSRFToken': Cookies.get('csrftoken')
    },
    data
  })
}
export function passengerDelete(data, token) {
  return request({
    url: '/manage/passenger/',
    method: 'delete',
    params: { token },
    headers: {
      'X-CSRFToken': Cookies.get('csrftoken')
    },
    data
  })
}
export function modelField(model, token) {
  return request({
    url: '/manage/export',
    method: 'get',
    params: { token, model }
  })
}

